home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 48 / PC Gamer IT CD 48 1-2.iso / age2 / AoE2demo.exe / 1033 / CABFILE / MSGAME.CAB / Data / gamedata.drs / Unnamed File 000003.bina < prev    next >
Text File  |  1999-10-01  |  42KB  |  1,994 lines

  1. ;start the run-through
  2. (defrule
  3.     (true)
  4. =>
  5.     (set-goal infantry-upgrades NO)
  6.     (set-goal archer-upgrades NO)
  7.     (set-goal cav-upgrades NO)
  8. )
  9.  
  10. ;infantry civs
  11. (defrule
  12.     (soldier-count >= five-percent-pop)
  13.     (or
  14.         (or
  15.             (goal combat-arm INFANTRY)
  16.             (goal combat-supp INFANTRY)
  17.         )
  18.         (goal pre-unique-arm INFANTRY)
  19.     )
  20. =>
  21.     (set-goal infantry-upgrades YES)
  22. )
  23.  
  24. (defrule
  25.     (building-type-count castle > 0)
  26.     (soldier-count >= five-percent-pop)
  27.     (or
  28.         (or
  29.             (civ-selected celtic)
  30.             (civ-selected frankish)
  31.         )
  32.         (or
  33.             (or
  34.                 (civ-selected gothic)
  35.                 (civ-selected japanese)
  36.             )
  37.             (or
  38.                 (civ-selected teutonic)
  39.                 (civ-selected viking)
  40.             )
  41.         )
  42.     )
  43. =>
  44.     (set-goal infantry-upgrades YES)
  45. )
  46.  
  47. ;archer civs
  48. (defrule
  49.     (soldier-count >= five-percent-pop)
  50.     (or
  51.         (or
  52.             (goal combat-arm CAVARCHER)
  53.             (goal combat-arm ARCHER)
  54.         )
  55.         (or
  56.             (or
  57.                 (goal combat-supp CAVARCHER)
  58.                 (goal combat-supp ARCHER)
  59.             )
  60.             (or
  61.                 (goal pre-unique-arm CAVARCHER)
  62.                 (goal pre-unique-arm ARCHER)
  63.             )
  64.         )
  65.     )
  66. =>
  67.     (set-goal archer-upgrades YES)
  68. )
  69.  
  70. (defrule
  71.     (building-type-count castle > 0)
  72.     (soldier-count >= five-percent-pop)
  73.     (or
  74.         (or
  75.             (civ-selected briton)
  76.             (civ-selected chinese)
  77.         )
  78.         (or
  79.             (civ-selected mongol)
  80.             (civ-selected turkish)
  81.         )
  82.     )
  83. =>
  84.     (set-goal archer-upgrades YES)
  85. )
  86.  
  87. ;cav civs
  88. (defrule
  89.     (soldier-count >= five-percent-pop)
  90.     (or
  91.         (goal pre-unique-arm CAVALRY)
  92.         (or
  93.             (or
  94.                 (goal combat-arm CAVALRY)
  95.                 (goal combat-arm LIGHTCAV)
  96.             )
  97.             (or
  98.                 (goal combat-supp CAVALRY)
  99.                 (goal combat-supp LIGHTCAV)
  100.             )
  101.         )
  102.     )
  103. =>
  104.     (set-goal cav-upgrades YES)
  105. )
  106.  
  107. (defrule
  108.     (building-type-count castle > 0)
  109.     (soldier-count >= five-percent-pop)
  110.     (or
  111.         (or
  112.             (civ-selected byzantine)
  113.             (civ-selected persian)
  114.         )
  115.         (civ-selected saracen)
  116.     )
  117. =>
  118.     (set-goal cav-upgrades YES)
  119. )
  120.  
  121. ;*************************************************
  122. (defrule
  123.     (or
  124.         (current-age >= feudal-age)
  125.         (goal upgrade-conflict NOTICE)
  126.     )
  127. =>
  128.     (set-escrow-percentage wood 50)
  129.     (set-escrow-percentage food 50)
  130.     (set-escrow-percentage gold 50)
  131.     (set-escrow-percentage stone 50)
  132. )
  133.  
  134. ;********************************************
  135. (defrule
  136.     (goal upgrade-conflict NO)
  137.     (current-age >= feudal-age)
  138. =>
  139.     (generate-random-number 41)
  140. )
  141.  
  142. (defrule
  143.     (difficulty <= moderate)
  144.     (food-amount >= 400)
  145.     (gold-amount >= 400)
  146.     (building-type-count castle > 0)
  147.     (unit-type-count my-unique-unit > five-percent-pop)
  148.     (or
  149.         (research-available my-unique-unit-upgrade)
  150.         (research-available ri-elite-longboat)
  151.     )
  152.     (not (goal upgrade-conflict NOTICE) )
  153. =>
  154.     (set-goal upgrade-conflict 90)
  155.     (set-goal resource-supp FOOD-GOLD)
  156. )
  157.  
  158. (defrule
  159.     (goal upgrade-conflict 90)
  160.     (can-research-with-escrow my-unique-unit-upgrade)
  161. =>
  162.     (release-escrow food)
  163.     (release-escrow gold)
  164.     (research my-unique-unit-upgrade)
  165.     (set-goal upgrade-conflict NO)
  166. )
  167.  
  168. (defrule    ;750 food, 475 gold
  169.     (goal upgrade-conflict 90)
  170.     (unit-type-count my-unique-unit < five-percent-pop)
  171.     (unit-type-count-total longboat > 2)
  172.     (can-research-with-escrow ri-elite-longboat)
  173. =>
  174.     (release-escrow food)
  175.     (release-escrow gold)
  176.     (research ri-elite-longboat)
  177.     (set-goal resource-supp NO)
  178. )
  179.  
  180. ;*************
  181. ;TOWN CENTER RESEARCH
  182. (defrule    ;50 gold
  183.     (goal upgrade-conflict NO)
  184.     (civilian-population >= civ-dark)
  185.     (random-number <= 1)
  186.     (building-type-count town-center > 0)
  187.     (research-available ri-loom)
  188.     (or
  189.         (gold-amount > 250)
  190.         (goal age-advancement NOTICE)
  191.     )
  192. =>
  193.     (set-goal upgrade-conflict 1)
  194.     (set-goal resource-supp GOLD-ONLY)
  195. )
  196.  
  197. (defrule
  198.     (goal upgrade-conflict 1)
  199.     (can-research-with-escrow ri-loom)
  200. =>
  201.     (release-escrow gold)
  202.     (research ri-loom)
  203.     (set-goal upgrade-conflict NO)
  204. )
  205.  
  206. (defrule    ;75 food
  207.     (goal upgrade-conflict NO)
  208.     (random-number <= 2)
  209.     (building-type-count town-center > 0)
  210.     (research-available ri-town-watch)
  211.     (or
  212.         (goal age-advancement NOTICE)
  213.         (food-amount > 700)
  214.     )
  215. =>
  216.     (set-goal upgrade-conflict 2)
  217.     (set-goal resource-supp FOOD-ONLY)
  218. )
  219.  
  220. (defrule    ;300 food, 200 gold
  221.     (goal upgrade-conflict NO)
  222.     (random-number <= 2)
  223.     (building-type-count town-center > 0)
  224.     (research-available ri-town-patrol)
  225. =>
  226.     (set-goal upgrade-conflict 2)
  227.     (set-goal resource-supp FOOD-GOLD)
  228. )
  229.  
  230. (defrule
  231.     (goal upgrade-conflict 2)
  232.     (can-research-with-escrow ri-town-watch)
  233. =>
  234.     (release-escrow food)
  235.     (research ri-town-watch)
  236.     (set-goal upgrade-conflict NO)
  237. )
  238.  
  239. (defrule
  240.     (goal upgrade-conflict 2)
  241.     (can-research-with-escrow ri-town-patrol)
  242. =>
  243.     (release-escrow food)
  244.     (release-escrow gold)
  245.     (research ri-town-patrol)
  246.     (set-goal upgrade-conflict NO)
  247. )
  248.  
  249. (defrule    ;50 wood, 175 food
  250.     (difficulty <= moderate)
  251.     (can-research-with-escrow ri-wheel-barrow)
  252.     (nor
  253.         (goal upgrade-conflict NOTICE)
  254.         (can-research ri-wheel-barrow)
  255.     )
  256.     (or
  257.         (current-age > feudal-age)
  258.         (goal age-advancement NOTICE)
  259.     )
  260. =>
  261.     (release-escrow wood)
  262.     (release-escrow food)
  263.     (research ri-wheel-barrow)
  264. )
  265.  
  266. (defrule
  267.     (difficulty <= moderate)
  268.     (can-research ri-wheel-barrow)
  269.     (not (goal upgrade-conflict NOTICE) )
  270.     (or
  271.         (current-age > feudal-age)
  272.         (goal age-advancement NOTICE)
  273.     )
  274. =>
  275.     (research ri-wheel-barrow)
  276. )
  277.  
  278. (defrule    ;200 wood, 300 food
  279.     (civilian-population >= civ-castle)
  280.     (difficulty <= hard)
  281.     (can-research-with-escrow ri-hand-cart)
  282.     (nor
  283.         (goal upgrade-conflict NOTICE)
  284.         (can-research ri-hand-cart)
  285.     )
  286. =>
  287.     (release-escrow wood)
  288.     (release-escrow food)
  289.     (research ri-hand-cart)
  290. )
  291.  
  292. (defrule
  293.     (civilian-population >= civ-castle)
  294.     (difficulty <= hard)
  295.     (can-research ri-hand-cart)
  296.     (not (goal upgrade-conflict NOTICE) )
  297. =>
  298.     (research ri-hand-cart)
  299. )
  300.  
  301. ;*************
  302. ;MINING-CAMP
  303. (defrule    ;75 wood, 100 food
  304.     (goal upgrade-conflict NO)
  305.     (difficulty <= moderate)
  306.     (random-number <= 3)
  307.     (civilian-population >= civ-castle)
  308.     (building-type-count mining-camp > 1)
  309.     (research-completed ri-gold-mining)
  310.     (research-available ri-stone-mining)
  311. =>
  312.     (set-goal upgrade-conflict 3)
  313.     (set-goal resource-supp WOOD-FOOD)
  314. )
  315.  
  316. (defrule    ;150 wood, 200 food
  317.     (goal upgrade-conflict NO)
  318.     (goal resource-needed STONE)
  319.     (difficulty <= hard)
  320.     (random-number <= 3)
  321.     (civilian-population >= civ-castle)
  322.     (building-type-count mining-camp > 0)
  323.     (research-completed ri-gold-shaft-mining)
  324.     (research-available ri-stone-shaft-mining)
  325. =>
  326.     (set-goal upgrade-conflict 3)
  327.     (set-goal resource-supp WOOD-FOOD)
  328. )
  329.  
  330. (defrule
  331.     (goal upgrade-conflict 3)
  332.     (or
  333.         (can-research-with-escrow ri-stone-mining)
  334.         (can-research-with-escrow ri-stone-shaft-mining)
  335.     )
  336. =>
  337.     (release-escrow wood)
  338.     (release-escrow food)
  339.     (research ri-stone-mining)
  340.     (research ri-stone-shaft-mining)
  341.     (set-goal upgrade-conflict NO)
  342. )
  343.  
  344. (defrule    ;75 wood, 100 food
  345.     (goal upgrade-conflict NO)
  346.     (difficulty <= moderate)
  347.     (current-age > feudal-age)
  348.     (random-number <= 4)
  349.     (civilian-population >= civ-castle)
  350.     (building-type-count mining-camp > 0)
  351.     (research-available ri-gold-mining)
  352. =>
  353.     (set-goal upgrade-conflict 4)
  354.     (set-goal resource-supp WOOD-FOOD)
  355. )
  356.  
  357. (defrule    ;150 wood, 200 food
  358.     (goal upgrade-conflict NO)
  359.     (difficulty <= hard)
  360.     (random-number <= 4)
  361.     (civilian-population >= civ-castle)
  362.     (building-type-count mining-camp > 0)
  363.     (research-available ri-gold-shaft-mining)
  364. =>
  365.     (set-goal upgrade-conflict 4)
  366.     (set-goal resource-supp WOOD-FOOD)
  367. )
  368.  
  369. (defrule
  370.     (goal upgrade-conflict 4)
  371.     (or
  372.         (can-research-with-escrow ri-gold-mining)
  373.         (can-research-with-escrow ri-gold-shaft-mining)
  374.     )
  375. =>
  376.     (release-escrow wood)
  377.     (release-escrow food)
  378.     (research ri-gold-mining)
  379.     (research ri-gold-shaft-mining)
  380.     (set-goal upgrade-conflict NO)
  381. )
  382. ;*************
  383. ;LUMBER-CAMP
  384. (defrule    ;50 wood, 100 food
  385.     (goal upgrade-conflict NO)
  386.     (difficulty <= moderate)
  387.     (random-number <= 5)
  388.     (building-type-count lumber-camp > 0)
  389.     (research-available ri-double-bit-axe)
  390.     (or
  391.         (current-age > feudal-age)
  392.         (goal age-advancement NOTICE)
  393.     )
  394. =>
  395.     (set-goal upgrade-conflict 5)
  396.     (set-goal resource-supp WOOD-FOOD)
  397. )
  398.  
  399. (defrule    ;100 wood, 150 food
  400.     (goal upgrade-conflict NO)
  401.     (difficulty <= moderate)
  402.     (random-number <= 5)
  403.     (civilian-population >= civ-castle)
  404.     (building-type-count lumber-camp > 0)
  405.     (research-available ri-bow-saw)
  406. =>
  407.     (set-goal upgrade-conflict 5)
  408.     (set-goal resource-supp WOOD-FOOD)
  409. )
  410.  
  411. (defrule    ;200 wood, 300 food
  412.     (goal upgrade-conflict NO)
  413.     (difficulty <= hard)
  414.     (random-number <= 5)
  415.     (civilian-population >= civ-castle)
  416.     (building-type-count lumber-camp > 0)
  417.     (research-available ri-two-man-saw)
  418. =>
  419.     (set-goal upgrade-conflict 5)
  420.     (set-goal resource-supp WOOD-FOOD)
  421. )
  422.  
  423. (defrule
  424.     (goal upgrade-conflict 5)
  425.     (or
  426.         (can-research-with-escrow ri-double-bit-axe)
  427.         (or
  428.             (can-research-with-escrow ri-bow-saw)
  429.             (can-research-with-escrow ri-two-man-saw)
  430.         )
  431.     )
  432. =>
  433.     (release-escrow wood)
  434.     (release-escrow food)
  435.     (research ri-double-bit-axe)
  436.     (research ri-bow-saw)
  437.     (research ri-two-man-saw)
  438.     (set-goal upgrade-conflict NO)
  439. )
  440. ;*************
  441. ;DOCK
  442. (defrule    ;200 wood, 300 gold
  443.     (goal upgrade-conflict NO)
  444.     (difficulty <= hard)
  445.     (random-number <= 6)
  446.     (building-type-count dock > 0)
  447.     (research-available ri-heavy-demolition-ship)
  448.     (not (goal 1 0) )
  449. =>
  450.     (set-goal upgrade-conflict 6)
  451.     (set-goal resource-supp WOOD-GOLD)
  452. )
  453.  
  454. (defrule
  455.     (goal upgrade-conflict 6)
  456.     (can-research-with-escrow ri-heavy-demolition-ship)
  457. =>
  458.     (release-escrow wood)
  459.     (release-escrow gold)
  460.     (research ri-heavy-demolition-ship)
  461.     (set-goal upgrade-conflict NO)
  462. )
  463.  
  464. (defrule    ;600 food, 400 gold
  465.     (goal upgrade-conflict NO)
  466.     (building-type-count dock > 0)
  467.     (research-available ri-dry-dock)
  468.     (random-number <= 7)
  469.     (not (goal 1 0) )
  470. =>
  471.     (set-goal upgrade-conflict 7)
  472.     (set-goal resource-supp FOOD-GOLD)
  473. )
  474.  
  475. (defrule
  476.     (goal upgrade-conflict 7)
  477.     (can-research-with-escrow ri-dry-dock)
  478. =>
  479.     (release-escrow food)
  480.     (release-escrow gold)
  481.     (research ri-dry-dock)
  482.     (set-goal upgrade-conflict NO)
  483. )
  484.  
  485. (defrule    ;1000 food, 300 gold
  486.     (goal upgrade-conflict NO)
  487.     (building-type-count dock > 0)
  488.     (research-available ri-shipwright)
  489.     (warboat-count > five-percent-pop)
  490.     (random-number <= 8)
  491. =>
  492.     (set-goal upgrade-conflict 8)
  493.     (set-goal resource-supp FOOD-GOLD)
  494. )
  495.  
  496. (defrule
  497.     (goal upgrade-conflict 8)
  498.     (can-research-with-escrow ri-shipwright)
  499. =>
  500.     (release-escrow food)
  501.     (release-escrow gold)
  502.     (research ri-shipwright)
  503.     (set-goal upgrade-conflict NO)
  504. )
  505.  
  506. (defrule    ;250 food, 150 gold
  507.     (building-type-count dock > 0)
  508.     (can-research-with-escrow ri-careening)
  509.     (nor
  510.         (goal 1 0)
  511.         (can-research ri-careening)
  512.     )
  513. =>
  514.     (release-escrow food)
  515.     (release-escrow gold)
  516.     (research ri-careening)
  517. )
  518.  
  519. (defrule
  520.     (building-type-count dock > 0)
  521.     (can-research ri-careening)
  522.     (not (goal 1 0) )
  523. =>
  524.     (research ri-careening)
  525. )
  526.  
  527. (defrule    ;280 wood, 250 gold
  528.     (building-type-count dock > 0)
  529.     (unit-type-count-total fire-ship-line > 1)
  530.     (can-research-with-escrow ri-fast-fire-ship)
  531.     (nor
  532.         (goal 1 0)
  533.         (can-research ri-fast-fire-ship)
  534.     )
  535. =>
  536.     (release-escrow wood)
  537.     (release-escrow gold)
  538.     (research ri-fast-fire-ship)
  539. )
  540.  
  541. (defrule
  542.     (building-type-count dock > 0)
  543.     (unit-type-count-total fire-ship-line > 1)
  544.     (can-research ri-fast-fire-ship)
  545.     (not (goal 1 0) )
  546. =>
  547.     (research ri-fast-fire-ship)
  548. )
  549.  
  550. (defrule    ;500 wood, 400 food
  551.     (difficulty <= moderate)
  552.     (building-type-count dock > 0)
  553.     (can-research-with-escrow ri-cannon-galleon)
  554.     (nor
  555.         (goal 1 0)
  556.         (can-research ri-cannon-galleon)
  557.     )
  558. =>
  559.     (release-escrow wood)
  560.     (release-escrow food)
  561.     (research ri-cannon-galleon)
  562. )
  563.  
  564. (defrule
  565.     (difficulty <= moderate)
  566.     (building-type-count dock > 0)
  567.     (can-research ri-cannon-galleon)
  568.     (not (goal 1 0) )
  569. =>
  570.     (research ri-cannon-galleon)
  571. )
  572.  
  573. (defrule    ;525 wood, 500 gold
  574.     (difficulty <= hard)
  575.     (building-type-count dock > 0)
  576.     (unit-type-count-total cannon-galleon > 0)
  577.     (can-research-with-escrow ri-deck-guns)
  578.     (not (can-research ri-deck-guns) )
  579. =>
  580.     (release-escrow wood)
  581.     (release-escrow gold)
  582.     (research ri-deck-guns)
  583. )
  584.  
  585. (defrule
  586.     (difficulty <= hard)
  587.     (building-type-count dock > 0)
  588.     (unit-type-count-total cannon-galleon > 0)
  589.     (can-research ri-deck-guns)
  590. =>
  591.     (research ri-deck-guns)
  592. )
  593.  
  594. (defrule    ;230 food, 100 gold
  595.     (building-type-count dock > 0)
  596.     (unit-type-count-total galley-line > 1)
  597.     (can-research-with-escrow ri-war-galley)
  598.     (nand
  599.         (civ-selected viking)
  600.         (building-type-count-total castle > 0)
  601.     )
  602.     (nor
  603.         (goal 1 0)
  604.         (can-research ri-war-galley)
  605.     )
  606. =>
  607.     (release-escrow food)
  608.     (release-escrow gold)
  609.     (research ri-war-galley)
  610. )
  611.  
  612. (defrule
  613.     (building-type-count dock > 0)
  614.     (unit-type-count-total galley-line > 1)
  615.     (can-research ri-war-galley)
  616.     (nand
  617.         (civ-selected viking)
  618.         (building-type-count-total castle > 0)
  619.     )
  620.     (not (goal 1 0) )
  621. =>
  622.     (research ri-war-galley)
  623. )
  624.  
  625. (defrule    ;315 wood, 400 food
  626.     (building-type-count dock > 0)
  627.     (can-research-with-escrow ri-galleon)
  628.     (nand
  629.         (civ-selected viking)
  630.         (building-type-count-total castle > 0)
  631.     )
  632.     (nor
  633.         (goal 1 0)
  634.         (can-research ri-galleon)
  635.     )
  636. =>
  637.     (release-escrow wood)
  638.     (release-escrow food)
  639.     (research ri-galleon)
  640. )
  641.  
  642. (defrule
  643.     (building-type-count dock > 0)
  644.     (can-research ri-galleon)
  645.     (nand
  646.         (civ-selected viking)
  647.         (building-type-count-total castle > 0)
  648.     )
  649.     (not (goal 1 0) )
  650. =>
  651.     (research ri-galleon)
  652. )
  653.  
  654.  
  655. ;*************
  656. ;MILL
  657. (defrule    ;75 wood, 75 food
  658.     (goal upgrade-conflict NO)
  659.     (difficulty <= moderate)
  660.     (random-number <= 9)
  661.     (building-type-count-total farm >= 8)
  662.     (building-type-count mill > 0)
  663.     (research-available ri-horse-collar)
  664.     (or
  665.         (current-age > feudal-age)
  666.         (goal age-advancement NOTICE)
  667.     )
  668. =>
  669.     (set-goal upgrade-conflict 9)
  670.     (set-goal resource-supp WOOD-FOOD)
  671. )
  672.  
  673. (defrule    ;125 wood, 125 food
  674.     (goal upgrade-conflict NO)
  675.     (difficulty <= moderate)
  676.     (random-number <= 9)
  677.     (building-type-count-total farm >= 10)
  678.     (building-type-count mill > 0)
  679.     (research-available ri-heavy-plow)
  680. =>
  681.     (set-goal upgrade-conflict 9)
  682.     (set-goal resource-supp WOOD-FOOD)
  683. )
  684.  
  685. (defrule    ;250 wood, 250 food
  686.     (goal upgrade-conflict NO)
  687.     (difficulty <= hard)
  688.     (random-number <= 9)
  689.     (building-type-count-total farm >= 12)
  690.     (building-type-count mill > 0)
  691.     (research-available ri-crop-rotation)
  692. =>
  693.     (set-goal upgrade-conflict 9)
  694.     (set-goal resource-supp WOOD-FOOD)
  695. )
  696.  
  697. (defrule
  698.     (goal upgrade-conflict 9)
  699.     (or
  700.         (can-research-with-escrow ri-horse-collar)
  701.         (or
  702.             (can-research-with-escrow ri-heavy-plow)
  703.             (can-research-with-escrow ri-crop-rotation)
  704.         )
  705.     )
  706. =>
  707.     (release-escrow wood)
  708.     (release-escrow food)
  709.     (research ri-horse-collar)
  710.     (research ri-heavy-plow)
  711.     (research ri-crop-rotation)
  712.     (set-goal upgrade-conflict NO)
  713. )
  714.  
  715. ;*************
  716. ;MARKET
  717. (defrule    ;150 food, 50 gold
  718.     (goal upgrade-conflict NO)
  719.     (difficulty <= moderate)
  720.     (random-number <= 10)
  721.     (player-in-game any-ally)
  722.     (building-type-count market > 0)
  723.     (research-available ri-coinage)
  724.     (or
  725.         (current-age > feudal-age)
  726.         (goal age-advancement NOTICE)
  727.     )
  728. =>
  729.     (set-goal upgrade-conflict 10)
  730.     (set-goal resource-supp FOOD-GOLD)
  731. )
  732.  
  733. (defrule    ;200 food, 100 gold
  734.     (goal upgrade-conflict NO)
  735.     (difficulty <= moderate)
  736.     (random-number <= 10)
  737.     (player-in-game any-ally)
  738.     (building-type-count market > 0)
  739.     (research-available ri-banking)
  740. =>
  741.     (set-goal upgrade-conflict 10)
  742.     (set-goal resource-supp FOOD-GOLD)
  743. )
  744.  
  745. (defrule
  746.     (goal upgrade-conflict 10)
  747.     (or
  748.         (can-research-with-escrow ri-coinage)
  749.         (can-research-with-escrow ri-banking)
  750.     )
  751. =>
  752.     (release-escrow food)
  753.     (release-escrow gold)
  754.     (research ri-coinage)
  755.     (research ri-banking)
  756.     (set-goal upgrade-conflict NO)
  757. )
  758.  
  759. (defrule    ;100 food, 100 gold
  760.     (player-in-game any-ally)
  761.     (building-type-count market > 0)
  762.     (can-research-with-escrow ri-cartography)
  763.     (or
  764.         (current-age > feudal-age)
  765.         (or
  766.             (goal age-advancement NOTICE)
  767.             (gold-amount > 300)
  768.         )
  769.     )
  770. =>
  771.     (release-escrow food)
  772.     (release-escrow gold)
  773.     (research ri-cartography)
  774. )
  775.  
  776. (defrule    ;300 food, 200 gold
  777.     (can-research-with-escrow ri-guilds)
  778. =>
  779.     (release-escrow food)
  780.     (release-escrow gold)
  781.     (research ri-guilds)
  782. )
  783. ;*************
  784. ;BARRACKS
  785. (defrule    ;75 food
  786.     (goal upgrade-conflict NO)
  787.     (goal infantry-upgrades YES)
  788.     (random-number <= 11)
  789.     (research-available ri-tracking)
  790.     (or
  791.         (current-age > feudal-age)
  792.         (goal age-advancement NOTICE)
  793.     )
  794. =>
  795.     (set-goal upgrade-conflict 11)
  796.     (set-goal resource-supp FOOD-ONLY)
  797. )
  798.  
  799. (defrule
  800.     (goal upgrade-conflict 11)
  801.     (can-research-with-escrow ri-tracking)
  802. =>
  803.     (release-escrow food)
  804.     (research ri-tracking)
  805.     (set-goal upgrade-conflict NO)
  806. )
  807.  
  808. (defrule    ;750 food, 350 gold
  809.     (goal upgrade-conflict NO)
  810.     (building-type-count barracks > 0)
  811.     (research-available ri-champion)
  812.     (random-number <= 12)
  813.     (goal combat-arm INFANTRY)
  814. =>
  815.     (set-goal upgrade-conflict 18)
  816.     (set-goal resource-supp FOOD-GOLD)
  817. )
  818.  
  819. (defrule
  820.     (goal upgrade-conflict 12)
  821.     (can-research-with-escrow ri-champion)
  822. =>
  823.     (release-escrow food)
  824.     (release-escrow gold)
  825.     (research ri-champion)
  826.     (set-goal upgrade-conflict NO)
  827. )
  828.  
  829. (defrule    ;200 food
  830.     (goal upgrade-conflict NO)
  831.     (goal infantry-upgrades YES)
  832.     (building-type-count barracks > 0)
  833.     (research-available ri-squires)
  834.     (random-number <= 13)
  835. =>
  836.     (set-goal upgrade-conflict 13)
  837.     (set-goal resource-supp FOOD-ONLY)
  838. )
  839.  
  840. (defrule
  841.     (goal upgrade-conflict 13)
  842.     (can-research-with-escrow ri-squires)
  843. =>
  844.     (release-escrow food)
  845.     (research ri-squires)
  846.     (set-goal upgrade-conflict NO)
  847. )
  848.  
  849. (defrule    ;215 food, 90 gold
  850.     (unit-type-count spearman > 2)
  851.     (can-research-with-escrow ri-pikeman)
  852.     (or
  853.         (goal upgrade-conflict NO)
  854.         (current-age == imperial-age)
  855.     )
  856.     (nor
  857.         (goal upgrade-conflict NOTICE)
  858.         (can-research ri-pikeman)
  859.     )
  860. =>
  861.     (release-escrow food)
  862.     (release-escrow gold)
  863.     (research ri-pikeman)
  864. )
  865.  
  866. (defrule
  867.     (unit-type-count spearman > 2)
  868.     (can-research ri-pikeman)
  869.     (or
  870.         (goal upgrade-conflict NO)
  871.         (current-age == imperial-age)
  872.     )
  873.     (not (goal upgrade-conflict NOTICE) )
  874. =>
  875.     (research ri-pikeman)
  876. )
  877.  
  878. (defrule    ;100 food, 40 gold
  879.     (can-research-with-escrow ri-man-at-arms)
  880.     (or
  881.         (goal upgrade-conflict NO)
  882.         (or
  883.             (current-age > feudal-age)
  884.             (goal age-advancement NOTICE)
  885.         )
  886.     )
  887.     (or
  888.         (or
  889.             (goal combat-arm INFANTRY)
  890.             (goal combat-supp INFANTRY)
  891.         )
  892.         (goal pre-unique-arm INFANTRY)
  893.     )
  894. =>
  895.     (release-escrow food)
  896.     (release-escrow gold)
  897.     (research ri-man-at-arms)
  898. )
  899.  
  900. (defrule    ;200 food, 65 gold
  901.     (can-research-with-escrow ri-long-swordsman)
  902.     (or
  903.         (goal upgrade-conflict NO)
  904.         (current-age-time > 300)
  905.     )
  906.     (or
  907.         (or
  908.             (goal combat-arm INFANTRY)
  909.             (goal combat-supp INFANTRY)
  910.         )
  911.         (goal pre-unique-arm INFANTRY)
  912.     )
  913. =>
  914.     (release-escrow food)
  915.     (release-escrow gold)
  916.     (research ri-long-swordsman)
  917. )
  918.  
  919. (defrule    ;300 food, 100 gold
  920.     (can-research-with-escrow ri-two-handed-swordsman)
  921.     (or
  922.         (goal upgrade-conflict NO)
  923.         (current-age-time > 600)
  924.     )
  925.     (or
  926.         (goal combat-arm INFANTRY)
  927.         (goal combat-supp INFANTRY)
  928.     )
  929. =>
  930.     (release-escrow food)
  931.     (release-escrow gold)
  932.     (research ri-two-handed-swordsman)
  933. )
  934. ;*************
  935. ;STABLE
  936. (defrule    ;325 food, 360 gold
  937.     (goal upgrade-conflict NO)
  938.     (building-type-count stable > 0)
  939.     (unit-type-count camel > 2)
  940.     (research-available ri-heavy-camel)
  941.     (random-number <= 14)
  942. =>
  943.     (set-goal upgrade-conflict 14)
  944.     (set-goal resource-supp FOOD-GOLD)
  945. )
  946.  
  947. (defrule
  948.     (goal upgrade-conflict 14)
  949.     (can-research-with-escrow ri-heavy-camel)
  950. =>
  951.     (release-escrow food)
  952.     (release-escrow gold)
  953.     (research ri-heavy-camel)
  954.     (set-goal upgrade-conflict NO)
  955. )
  956.  
  957. (defrule    ;1300 food, 750 gold
  958.     (goal upgrade-conflict NO)
  959.     (random-number <= 15)
  960.     (building-type-count stable > 0)
  961.     (research-available ri-paladin)
  962.     (or
  963.         (goal combat-arm CAVALRY)
  964.         (goal combat-arm LIGHTCAV)
  965.     )
  966. =>
  967.     (set-goal upgrade-conflict 15)
  968.     (set-goal resource-supp FOOD-GOLD)
  969. )
  970.  
  971. (defrule
  972.     (goal upgrade-conflict 15)
  973.     (or
  974.         (can-research-with-escrow ri-cavalier)
  975.         (can-research-with-escrow ri-paladin)
  976.     )
  977. =>
  978.     (release-escrow food)
  979.     (release-escrow gold)
  980.     (research ri-cavalier)
  981.     (research ri-paladin)
  982.     (set-goal upgrade-conflict NO)
  983. )
  984.  
  985. (defrule    ;250 food
  986.     (goal upgrade-conflict NO)
  987.     (building-type-count stable > 0)
  988.     (research-available ri-husbandry)
  989.     (random-number <= 16)
  990.     (or
  991.         (or
  992.             (goal cav-upgrades YES)
  993.             (goal combat-arm CAVARCHER)
  994.         )
  995.         (or
  996.             (goal combat-supp CAVARCHER)
  997.             (civ-selected mongol)
  998.         )
  999.     )
  1000. =>
  1001.     (set-goal upgrade-conflict 16)
  1002.     (set-goal resource-supp FOOD-ONLY)
  1003. )
  1004.  
  1005. (defrule
  1006.     (goal upgrade-conflict 16)
  1007.     (can-research-with-escrow ri-husbandry)
  1008. =>
  1009.     (release-escrow food)
  1010.     (research ri-husbandry)
  1011.     (set-goal upgrade-conflict NO)
  1012. )
  1013.  
  1014. (defrule    ;300 food, 300 gold
  1015.     (can-research-with-escrow ri-cavalier)
  1016.     (or
  1017.         (goal upgrade-conflict NO)
  1018.         (current-age > 300)
  1019.     )
  1020.     (or
  1021.         (goal combat-arm CAVALRY)
  1022.         (or
  1023.             (goal combat-supp CAVALRY)
  1024.             (goal combat-arm LIGHTCAV)
  1025.         )
  1026.     )
  1027. =>
  1028.     (release-escrow food)
  1029.     (release-escrow gold)
  1030.     (research ri-cavalier)
  1031. )
  1032.  
  1033. (defrule    ;150 food, 50 gold
  1034.     (can-research-with-escrow ri-light-cavalry)
  1035.     (or
  1036.         (or
  1037.             (goal combat-arm LIGHTCAV)
  1038.             (goal combat-supp LIGHTCAV)
  1039.         )
  1040.         (unit-type-count-total scout-cavalry > 2)
  1041.     )
  1042.     (or
  1043.         (goal upgrade-conflict NO)
  1044.         (current-age == imperial-age)
  1045.     )
  1046. =>
  1047.     (release-escrow food)
  1048.     (release-escrow gold)
  1049.     (research ri-light-cavalry)
  1050. )
  1051. ;*************
  1052. ;ARCHERY RANGE
  1053. (defrule    ;350 food, 300 gold
  1054.     (goal upgrade-conflict NO)
  1055.     (building-type-count archery-range > 0)
  1056.     (research-available ri-arbalest)
  1057.     (random-number <= 17)
  1058.     (nor
  1059.         (research-available ri-hand-cannon)
  1060.         (research-completed ri-hand-cannon)
  1061.     )
  1062.     (or
  1063.         (goal combat-arm ARCHER)
  1064.         (goal combat-supp ARCHER)
  1065.     )
  1066. =>
  1067.     (set-goal upgrade-conflict 17)
  1068.     (set-goal resource-supp FOOD-GOLD)
  1069. )
  1070.  
  1071. (defrule
  1072.     (goal upgrade-conflict 17)
  1073.     (can-research-with-escrow ri-arbalest)
  1074. =>
  1075.     (release-escrow food)
  1076.     (release-escrow gold)
  1077.     (research ri-arbalest)
  1078.     (set-goal upgrade-conflict NO)
  1079. )
  1080.  
  1081. (defrule
  1082.     (goal upgrade-conflict 17)
  1083.     (research-completed ri-hand-cannon)
  1084. =>
  1085.     (set-goal upgrade-conflict NO)
  1086. )
  1087.  
  1088. (defrule    ;450 food, 200 gold
  1089.     (building-type-count archery-range > 0)
  1090.     (can-research-with-escrow ri-hand-cannon)
  1091. =>
  1092.     (release-escrow food)
  1093.     (release-escrow gold)
  1094.     (research ri-hand-cannon)
  1095. )
  1096.  
  1097. (defrule    ;900 food, 500 gold
  1098.     (goal upgrade-conflict NO)
  1099.     (goal combat-arm CAVARCHER)
  1100.     (building-type-count archery-range > 0)
  1101.     (research-available ri-heavy-cavalry-archer)
  1102.     (random-number <= 18)
  1103. =>
  1104.     (set-goal upgrade-conflict 18)
  1105.     (set-goal resource-supp FOOD-GOLD)
  1106. )
  1107.  
  1108. (defrule
  1109.     (goal upgrade-conflict 18)
  1110.     (can-research-with-escrow ri-heavy-cavalry-archer)
  1111. =>
  1112.     (release-escrow food)
  1113.     (release-escrow gold)
  1114.     (research ri-heavy-cavalry-archer)
  1115.     (set-goal upgrade-conflict NO)
  1116. )
  1117.  
  1118. (defrule    ;250 wood, 160 gold
  1119.     (unit-type-count skirmisher > 2)
  1120.     (can-research-with-escrow ri-elite-skirmisher)
  1121.     (or
  1122.         (goal upgrade-conflict NO)
  1123.         (current-age-time > 300)
  1124.     )
  1125. =>
  1126.     (release-escrow wood)
  1127.     (release-escrow gold)
  1128.     (research ri-elite-skirmisher)
  1129. )
  1130.  
  1131. (defrule    ;125 food, 75 gold
  1132.     (research-available ri-crossbow)
  1133.     (or
  1134.         (goal upgrade-conflict NO)
  1135.         (current-age-time > 300)
  1136.     )
  1137.     (nor
  1138.         (research-available ri-hand-cannon)
  1139.         (research-completed ri-hand-cannon)
  1140.     )
  1141.     (or
  1142.         (goal combat-arm ARCHER)
  1143.         (or
  1144.             (goal combat-supp ARCHER)
  1145.             (goal pre-unique-arm ARCHER)
  1146.         )
  1147.     )
  1148. =>
  1149.     (release-escrow food)
  1150.     (release-escrow gold)
  1151.     (research ri-crossbow)
  1152. )
  1153. ;*************
  1154. ;BLACKSMITH
  1155. (defrule    ;100 food
  1156.     (difficulty <= moderate)
  1157.     (goal infantry-upgrades YES)
  1158.     (can-research-with-escrow ri-scale-mail)
  1159.     (or
  1160.         (goal upgrade-conflict NO)
  1161.         (or
  1162.             (current-age > feudal-age)
  1163.             (goal age-advancement NOTICE)
  1164.         )
  1165.     )
  1166. =>
  1167.     (release-escrow food)
  1168.     (research ri-scale-mail)
  1169. )
  1170.  
  1171. (defrule    ;200 food, 100 gold
  1172.     (difficulty <= moderate)
  1173.     (goal infantry-upgrades YES)
  1174.     (can-research-with-escrow ri-chain-mail)
  1175.     (or
  1176.         (goal upgrade-conflict NO)
  1177.         (or
  1178.             (current-age-time > 300)
  1179.             (goal age-advancement NOTICE)
  1180.         )
  1181.     )
  1182. =>
  1183.     (release-escrow food)
  1184.     (release-escrow gold)
  1185.     (research ri-chain-mail)
  1186. )
  1187.  
  1188. (defrule    ;300 food, 150 gold
  1189.     (goal upgrade-conflict NO)
  1190.     (random-number <= 19)
  1191.     (difficulty <= hard)
  1192.     (goal infantry-upgrades YES)
  1193.     (building-type-count blacksmith > 0)
  1194.     (research-available ri-plate-mail)
  1195. =>
  1196.     (set-goal upgrade-conflict 19)
  1197.     (set-goal resource-supp FOOD-GOLD)
  1198. )
  1199.  
  1200. (defrule
  1201.     (goal upgrade-conflict 19)
  1202.     (can-research-with-escrow ri-plate-mail)
  1203. =>
  1204.     (release-escrow food)
  1205.     (release-escrow gold)
  1206.     (research ri-plate-mail)
  1207.     (set-goal upgrade-conflict NO)
  1208. )
  1209.  
  1210. (defrule    ;150 food
  1211.     (difficulty <= moderate)
  1212.     (goal cav-upgrades YES)
  1213.     (can-research-with-escrow ri-scale-barding)
  1214.     (or
  1215.         (goal upgrade-conflict NO)
  1216.         (or
  1217.             (current-age > feudal-age)
  1218.             (goal age-advancement NOTICE)
  1219.         )
  1220.     )
  1221. =>
  1222.     (release-escrow food)
  1223.     (research ri-scale-barding)
  1224. )
  1225.  
  1226. (defrule    ;250 food, 150 gold
  1227.     (difficulty <= moderate)
  1228.     (goal cav-upgrades YES)
  1229.     (can-research-with-escrow ri-chain-barding)
  1230.     (or
  1231.         (goal upgrade-conflict NO)
  1232.         (or
  1233.             (current-age-time > 300)
  1234.             (goal age-advancement NOTICE)
  1235.         )
  1236.     )
  1237. =>
  1238.     (release-escrow food)
  1239.     (release-escrow gold)
  1240.     (research ri-chain-barding)
  1241. )
  1242.  
  1243. (defrule    ;350 food, 200 gold
  1244.     (goal upgrade-conflict NO)
  1245.     (random-number <= 20)
  1246.     (difficulty <= hard)
  1247.     (goal cav-upgrades YES)
  1248.     (building-type-count blacksmith > 0)
  1249.     (research-available ri-plate-barding)
  1250. =>
  1251.     (set-goal upgrade-conflict 20)
  1252.     (set-goal resource-supp FOOD-GOLD)
  1253. )
  1254.  
  1255. (defrule
  1256.     (goal upgrade-conflict 20)
  1257.     (can-research-with-escrow ri-plate-barding)
  1258. =>
  1259.     (release-escrow food)
  1260.     (release-escrow gold)
  1261.     (research ri-plate-barding)
  1262.     (set-goal upgrade-conflict NO)
  1263. )
  1264.  
  1265. (defrule    ;100 food
  1266.     (difficulty <= moderate)
  1267.     (goal archer-upgrades YES)
  1268.     (can-research-with-escrow ri-padded-archer-armor)
  1269.     (or
  1270.         (goal upgrade-conflict NO)
  1271.         (or
  1272.             (current-age > feudal-age)
  1273.             (goal age-advancement NOTICE)
  1274.         )
  1275.     )
  1276. =>
  1277.     (release-escrow food)
  1278.     (research ri-padded-archer-armor)
  1279. )
  1280.  
  1281. (defrule    ;150 food, 150 gold
  1282.     (difficulty <= moderate)
  1283.     (goal archer-upgrades YES)
  1284.     (can-research-with-escrow ri-leather-archer-armor)
  1285.     (or
  1286.         (goal upgrade-conflict NO)
  1287.         (or
  1288.             (current-age-time > 300)
  1289.             (goal age-advancement NOTICE)
  1290.         )
  1291.     )
  1292. =>
  1293.     (release-escrow food)
  1294.     (release-escrow gold)
  1295.     (research ri-leather-archer-armor)
  1296. )
  1297.  
  1298. (defrule    ;250 food, 250 gold
  1299.     (goal upgrade-conflict NO)
  1300.     (random-number <= 21)
  1301.     (difficulty <= hard)
  1302.     (goal archer-upgrades YES)
  1303.     (building-type-count blacksmith > 0)
  1304.     (research-available ri-ring-archer-armor)
  1305. =>
  1306.     (set-goal upgrade-conflict 21)
  1307.     (set-goal resource-supp FOOD-GOLD)
  1308. )
  1309.  
  1310. (defrule
  1311.     (goal upgrade-conflict 21)
  1312.     (can-research-with-escrow ri-ring-archer-armor)
  1313. =>
  1314.     (release-escrow food)
  1315.     (release-escrow gold)
  1316.     (research ri-ring-archer-armor)
  1317.     (set-goal upgrade-conflict NO)
  1318. )
  1319.  
  1320. (defrule    ;150 food
  1321.     (difficulty <= moderate)
  1322.     (can-research-with-escrow ri-forging)
  1323.     (or
  1324.         (goal infantry-upgrades YES)
  1325.         (goal cav-upgrades YES)
  1326.     )
  1327.     (or
  1328.         (goal upgrade-conflict NO)
  1329.         (or
  1330.             (current-age > feudal-age)
  1331.             (goal age-advancement NOTICE)
  1332.         )
  1333.     )
  1334. =>
  1335.     (release-escrow food)
  1336.     (research ri-forging)
  1337. )
  1338.  
  1339. (defrule    ;220 food, 120 gold
  1340.     (difficulty <= moderate)
  1341.     (can-research-with-escrow ri-iron-casting)
  1342.     (or
  1343.         (goal infantry-upgrades YES)
  1344.         (goal cav-upgrades YES)
  1345.     )
  1346.     (or
  1347.         (goal upgrade-conflict NO)
  1348.         (or
  1349.             (current-age-time > 300)
  1350.             (goal age-advancement NOTICE)
  1351.         )
  1352.     )
  1353. =>
  1354.     (release-escrow food)
  1355.     (release-escrow gold)
  1356.     (research ri-iron-casting)
  1357. )
  1358.  
  1359. (defrule    ;275 food, 225 gold
  1360.     (goal upgrade-conflict NO)
  1361.     (random-number <= 22)
  1362.     (difficulty <= hard)
  1363.     (building-type-count blacksmith > 0)
  1364.     (research-available ri-blast-furnace)
  1365.     (or
  1366.         (goal infantry-upgrades YES)
  1367.         (goal cav-upgrades YES)
  1368.     )
  1369. =>
  1370.     (set-goal upgrade-conflict 22)
  1371.     (set-goal resource-supp FOOD-GOLD)
  1372. )
  1373.  
  1374. (defrule
  1375.     (goal upgrade-conflict 22)
  1376.     (can-research-with-escrow ri-blast-furnace)
  1377. =>
  1378.     (release-escrow food)
  1379.     (release-escrow gold)
  1380.     (research ri-blast-furnace)
  1381.     (set-goal upgrade-conflict NO)
  1382. )
  1383.  
  1384. (defrule    ;100 food, 50 gold
  1385.     (difficulty <= moderate)
  1386.     (can-research-with-escrow ri-fletching)
  1387.     (or
  1388.         (goal archer-upgrades YES)
  1389.         (or
  1390.             (unit-type-count galley-line > five-percent-pop)
  1391.             (building-type-count watch-tower-line > five-percent-pop)
  1392.         )
  1393.     )
  1394.     (or
  1395.         (goal upgrade-conflict NO)
  1396.         (or
  1397.             (current-age > feudal-age)
  1398.             (goal age-advancement NOTICE)
  1399.         )
  1400.     )
  1401. =>
  1402.     (release-escrow food)
  1403.     (release-escrow gold)
  1404.     (research ri-fletching)
  1405. )
  1406.  
  1407. (defrule    ;200 food, 100 gold
  1408.     (can-research-with-escrow ri-bodkin-arrow)
  1409.     (or
  1410.         (goal archer-upgrades YES)
  1411.         (or
  1412.             (unit-type-count galley-line > five-percent-pop)
  1413.             (building-type-count watch-tower-line > five-percent-pop)
  1414.         )
  1415.     )
  1416.     (or
  1417.         (goal upgrade-conflict NO)
  1418.         (or
  1419.             (current-age-time > 300)
  1420.             (goal age-advancement NOTICE)
  1421.         )
  1422.     )
  1423. =>
  1424.     (release-escrow food)
  1425.     (release-escrow gold)
  1426.     (research ri-bodkin-arrow)
  1427. )
  1428.  
  1429. (defrule    ;300 food, 200 gold
  1430.     (goal upgrade-conflict NO)
  1431.     (random-number <= 23)
  1432.     (difficulty <= hard)
  1433.     (building-type-count blacksmith > 0)
  1434.     (research-available ri-bracer)
  1435.     (or
  1436.         (goal archer-upgrades YES)
  1437.         (or
  1438.             (unit-type-count galley-line > five-percent-pop)
  1439.             (building-type-count watch-tower-line > five-percent-pop)
  1440.         )
  1441.     )
  1442. =>
  1443.     (set-goal upgrade-conflict 23)
  1444.     (set-goal resource-supp FOOD-GOLD)
  1445. )
  1446.  
  1447. (defrule
  1448.     (goal upgrade-conflict 23)
  1449.     (can-research-with-escrow ri-bracer)
  1450. =>
  1451.     (release-escrow food)
  1452.     (release-escrow gold)
  1453.     (research ri-bracer)
  1454.     (set-goal upgrade-conflict NO)
  1455. )
  1456.  
  1457. ;*************
  1458. ;SIEGE-WORKSHOP
  1459. (defrule    ;1100 wood, 1000 food
  1460.     (goal upgrade-conflict NO)
  1461.     (goal combat-supp SCORPION)
  1462.     (difficulty <= moderate)
  1463.     (random-number <= 24)
  1464.     (building-type-count siege-workshop > 0)
  1465.     (research-available ri-heavy-scorpion)
  1466. =>
  1467.     (set-goal upgrade-conflict 24)
  1468.     (set-goal resource-supp WOOD-FOOD)
  1469. )
  1470.  
  1471. (defrule
  1472.     (goal upgrade-conflict 24)
  1473.     (can-research-with-escrow ri-heavy-scorpion)
  1474. =>
  1475.     (release-escrow wood)
  1476.     (release-escrow food)
  1477.     (research ri-heavy-scorpion)
  1478.     (set-goal upgrade-conflict NO)
  1479. )
  1480.  
  1481. (defrule
  1482.     (goal upgrade-conflict 24)
  1483.     (not (goal combat-supp SCORPION) )
  1484. =>
  1485.     (set-goal upgrade-conflict NO)
  1486. )
  1487.  
  1488. (defrule    ;300 food, 250 gold
  1489.     (goal upgrade-conflict NO)
  1490.     (difficulty <= moderate)
  1491.     (random-number <= 25)
  1492.     (building-type-count siege-workshop > 0)
  1493.     (research-available ri-capped-ram)
  1494. =>
  1495.     (set-goal upgrade-conflict 25)
  1496.     (set-goal resource-supp FOOD-GOLD)
  1497. )
  1498.  
  1499. (defrule    ;1000 food, 800 gold
  1500.     (goal upgrade-conflict NO)
  1501.     (difficulty <= moderate)
  1502.     (random-number <= 25)
  1503.     (building-type-count siege-workshop > 0)
  1504.     (unit-type-count-total capped-ram > 1)
  1505.     (research-available ri-siege-ram)
  1506.     (nor 
  1507.         (research-completed ri-bombard-cannon)
  1508.         (research-completed ri-siege-onager)
  1509.     )
  1510. =>
  1511.     (set-goal upgrade-conflict 25)
  1512.     (set-goal resource-supp FOOD-GOLD)
  1513. )
  1514.  
  1515. (defrule
  1516.     (goal upgrade-conflict 25)
  1517.     (or
  1518.         (can-research-with-escrow ri-capped-ram)
  1519.         (can-research-with-escrow ri-siege-ram)
  1520.     )
  1521. =>
  1522.     (release-escrow food)
  1523.     (release-escrow gold)
  1524.     (research ri-capped-ram)
  1525.     (research ri-siege-ram)
  1526.     (set-goal upgrade-conflict NO)
  1527. )
  1528.  
  1529. (defrule    ;800 food, 500 gold
  1530.     (goal upgrade-conflict NO)
  1531.     (difficulty <= moderate)
  1532.     (random-number <= 26)
  1533.     (building-type-count siege-workshop > 0)
  1534.     (research-available ri-onager)
  1535. =>
  1536.     (set-goal upgrade-conflict 26)
  1537.     (set-goal resource-supp FOOD-GOLD)
  1538. )
  1539.  
  1540. (defrule    ;1450 food, 1000 gold
  1541.     (goal upgrade-conflict NO)
  1542.     (difficulty <= moderate)
  1543.     (random-number <= 26)
  1544.     (unit-type-count-total onager > 1)
  1545.     (building-type-count siege-workshop > 0)
  1546.     (research-available ri-siege-onager)
  1547.     (nor
  1548.         (research-completed ri-bombard-cannon)
  1549.         (research-completed ri-siege-ram)
  1550.     )
  1551. =>
  1552.     (set-goal upgrade-conflict 26)
  1553.     (set-goal resource-supp FOOD-GOLD)
  1554. )
  1555.  
  1556. (defrule
  1557.     (goal upgrade-conflict 26)
  1558.     (or
  1559.         (can-research-with-escrow ri-onager)
  1560.         (can-research-with-escrow ri-siege-onager)
  1561.     )
  1562. =>
  1563.     (release-escrow food)
  1564.     (release-escrow gold)
  1565.     (research ri-onager)
  1566.     (research ri-siege-onager)
  1567.     (set-goal upgrade-conflict NO)
  1568. )
  1569.  
  1570. (defrule    ;500 food, 250 gold
  1571.     (difficulty <= moderate)
  1572.     (can-research-with-escrow ri-bombard-cannon)
  1573. =>
  1574.     (release-escrow food)
  1575.     (release-escrow gold)
  1576.     (research ri-bombard-cannon)
  1577. )
  1578.  
  1579. (defrule    ;600 wood, 500 food
  1580.     (goal upgrade-conflict NO)
  1581.     (difficulty <= moderate)
  1582.     (random-number <= 27)
  1583.     (building-type-count siege-workshop > 0)
  1584.     (research-available ri-siege-engineers)
  1585.     (or
  1586.         (or
  1587.             (unit-type-count battering-ram-line > 1)
  1588.             (unit-type-count mangonel-line > 1)
  1589.         )
  1590.         (or
  1591.             (unit-type-count bombard-cannon > 1)
  1592.             (unit-type-count trebuchet > 0)
  1593.         )
  1594.     )
  1595. =>
  1596.     (set-goal upgrade-conflict 27)
  1597.     (set-goal resource-supp WOOD-FOOD)
  1598. )
  1599.  
  1600. (defrule
  1601.     (goal upgrade-conflict 27)
  1602.     (can-research-with-escrow ri-siege-engineers)
  1603. =>
  1604.     (release-escrow wood)
  1605.     (release-escrow food)
  1606.     (research ri-siege-engineers)
  1607.     (set-goal upgrade-conflict NO)
  1608. )
  1609.  
  1610. ;*************
  1611. ;monastery
  1612. (defrule    ;475 gold
  1613.     (goal upgrade-conflict NO)
  1614.     (goal monk-rating GOOD)
  1615.     (building-type-count monastery > 0)
  1616.     (unit-type-count-total monk > 2)
  1617.     (research-available ri-redemption)
  1618.     (random-number <= 28)
  1619. =>
  1620.     (set-goal upgrade-conflict 28)
  1621.     (set-goal resource-supp GOLD-ONLY)
  1622. )
  1623.  
  1624. (defrule
  1625.     (goal upgrade-conflict 28)
  1626.     (can-research-with-escrow ri-redemption)
  1627. =>
  1628.     (release-escrow gold)
  1629.     (research ri-redemption)
  1630.     (set-goal upgrade-conflict NO)
  1631. )
  1632.  
  1633. (defrule    ;325 gold
  1634.     (goal upgrade-conflict NO)
  1635.     (goal monk-rating GOOD)
  1636.     (cc-players-unit-type-count any-enemy monk > 2)
  1637.     (building-type-count monastery > 0)
  1638.     (unit-type-count-total monk > 1)
  1639.     (research-available ri-atonement)
  1640.     (random-number <= 29)
  1641. =>
  1642.     (set-goal upgrade-conflict 29)
  1643.     (set-goal resource-supp GOLD-ONLY)
  1644. )
  1645.  
  1646. (defrule
  1647.     (goal upgrade-conflict 29)
  1648.     (can-research-with-escrow ri-atonement)
  1649. =>
  1650.     (release-escrow gold)
  1651.     (research ri-atonement)
  1652.     (set-goal upgrade-conflict NO)
  1653.     (set-goal resource-supp GOLD-ONLY)
  1654. )
  1655.  
  1656. (defrule    ;200 gold
  1657.     (goal upgrade-conflict NO)
  1658.     (goal monk-rating GOOD)
  1659.     (building-type-count monastery > 0)
  1660.     (unit-type-count-total monk > 1)
  1661.     (research-available ri-block-printing)
  1662.     (random-number <= 30)
  1663. =>
  1664.     (set-goal upgrade-conflict 30)
  1665.     (set-goal resource-supp GOLD-ONLY)
  1666. )
  1667.  
  1668. (defrule
  1669.     (goal upgrade-conflict 30)
  1670.     (can-research-with-escrow ri-block-printing)
  1671. =>
  1672.     (release-escrow gold)
  1673.     (research ri-block-printing)
  1674.     (set-goal upgrade-conflict NO)
  1675. )
  1676.  
  1677. (defrule    ;140 gold
  1678.     (goal upgrade-conflict NO)
  1679.     (building-type-count monastery > 0)
  1680.     (unit-type-count-total monk > 0)
  1681.     (research-available ri-fervor)
  1682.     (random-number <= 31)
  1683.     (or
  1684.         (goal monk-rating GOOD)
  1685.         (goal monk-rating FAIR)
  1686.     )
  1687. =>
  1688.     (set-goal upgrade-conflict 31)
  1689.     (set-goal resource-supp GOLD-ONLY)
  1690. )
  1691.  
  1692. (defrule
  1693.     (goal upgrade-conflict 31)
  1694.     (can-research-with-escrow ri-fervor)
  1695. =>
  1696.     (release-escrow gold)
  1697.     (research ri-fervor)
  1698.     (set-goal upgrade-conflict NO)
  1699. )
  1700.  
  1701. (defrule    ;120 gold
  1702.     (goal upgrade-conflict NO)
  1703.     (building-type-count monastery > 0)
  1704.     (unit-type-count-total monk > 0)
  1705.     (research-available ri-illumination)
  1706.     (random-number <= 32)
  1707.     (or
  1708.         (goal monk-rating GOOD)
  1709.         (goal monk-rating FAIR)
  1710.     )
  1711. =>
  1712.     (set-goal upgrade-conflict 32)
  1713.     (set-goal resource-supp GOLD-ONLY)
  1714. )
  1715.  
  1716. (defrule
  1717.     (goal upgrade-conflict 32)
  1718.     (can-research-with-escrow ri-illumination)
  1719. =>
  1720.     (release-escrow gold)
  1721.     (research ri-illumination)
  1722.     (set-goal upgrade-conflict NO)
  1723. )
  1724.  
  1725. (defrule    ;120 gold
  1726.     (goal upgrade-conflict NO)
  1727.     (building-type-count monastery > 0)
  1728.     (unit-type-count-total monk > 0)
  1729.     (research-available ri-sanctity)
  1730.     (random-number <= 33)
  1731.     (or
  1732.         (goal monk-rating GOOD)
  1733.         (goal monk-rating FAIR)
  1734.     )
  1735. =>
  1736.     (set-goal upgrade-conflict 33)
  1737.     (set-goal resource-supp GOLD-ONLY)
  1738. )
  1739.  
  1740. (defrule
  1741.     (goal upgrade-conflict 33)
  1742.     (can-research-with-escrow ri-sanctity)
  1743. =>
  1744.     (release-escrow gold)
  1745.     (research ri-sanctity)
  1746.     (set-goal upgrade-conflict NO)
  1747. )
  1748.  
  1749. (defrule    ;750 food, 1000 gold
  1750.     (goal upgrade-conflict NO)
  1751.     (random-number <= 34)
  1752.     (cc-players-unit-type-count any-enemy monk > 3)
  1753.     (building-type-count monastery > 0)
  1754.     (research-available ri-faith)
  1755. =>
  1756.     (set-goal upgrade-conflict 34)
  1757.     (set-goal resource-supp FOOD-GOLD)
  1758. )
  1759.  
  1760. (defrule
  1761.     (goal upgrade-conflict 34)
  1762.     (can-research-with-escrow ri-faith)
  1763. =>
  1764.     (release-escrow food)
  1765.     (release-escrow gold)
  1766.     (research ri-faith)
  1767.     (set-goal upgrade-conflict NO)
  1768. )
  1769.  
  1770. ;*************
  1771. ;UNIVERSITY
  1772. (defrule    ;175 wood, 150 stone
  1773.     (goal upgrade-conflict NO)
  1774.     (random-number <= 35)
  1775.     (building-type-count university > 0)
  1776.     (research-available ri-masonry)
  1777. =>
  1778.     (set-goal upgrade-conflict 35)
  1779.     (set-goal resource-supp WOOD-STONE)
  1780. )
  1781.  
  1782. (defrule    ;200 wood, 300 stone
  1783.     (goal upgrade-conflict NO)
  1784.     (random-number <= 35)
  1785.     (building-type-count university > 0)
  1786.     (research-available ri-architecture)
  1787.     (not (goal wonder-attempt POSSIBLE) )
  1788. =>
  1789.     (set-goal upgrade-conflict 35)
  1790.     (set-goal resource-supp WOOD-STONE)
  1791. )
  1792.  
  1793. (defrule
  1794.     (goal upgrade-conflict 35)
  1795.     (or
  1796.         (can-research-with-escrow ri-masonry)
  1797.         (can-research-with-escrow ri-architecture)
  1798.     )
  1799. =>
  1800.     (release-escrow wood)
  1801.     (release-escrow stone)
  1802.     (research ri-masonry)
  1803.     (research ri-architecture)
  1804.     (set-goal upgrade-conflict NO)
  1805. )
  1806.  
  1807. (defrule    ;200 wood, 300 stone
  1808.     (goal upgrade-conflict NO)
  1809.     (random-number <= 36)
  1810.     (building-type-count university > 0)
  1811.     (research-available ri-stonecutting)
  1812.     (not (goal wonder-attempt POSSIBLE) )
  1813. =>
  1814.     (set-goal upgrade-conflict 36)
  1815.     (set-goal resource-supp WOOD-STONE)
  1816. )
  1817.  
  1818. (defrule
  1819.     (goal upgrade-conflict 36)
  1820.     (can-research-with-escrow ri-stonecutting)
  1821. =>
  1822.     (release-escrow wood)
  1823.     (release-escrow stone)
  1824.     (research ri-stonecutting)
  1825.     (set-goal upgrade-conflict NO)
  1826. )
  1827.  
  1828. (defrule    ;100 food, 250 stone
  1829.     (building-type-count watch-tower > 2)
  1830.     (can-research-with-escrow ri-guard-tower)
  1831.     (or
  1832.         (goal upgrade-conflict NO)
  1833.         (current-age-time > 600)
  1834.     )
  1835. =>
  1836.     (release-escrow food)
  1837.     (release-escrow stone)
  1838.     (research ri-guard-tower)
  1839. )
  1840.  
  1841. (defrule    ;500 food, 350 stone
  1842.     (goal upgrade-conflict NO)
  1843.     (random-number <= 37)
  1844.     (building-type-count university > 0)
  1845.     (building-type-count guard-tower > 0)
  1846.     (research-available ri-keep)
  1847. =>
  1848.     (set-goal upgrade-conflict 37)
  1849.     (set-goal resource-supp FOOD-STONE)
  1850. )
  1851.  
  1852. (defrule
  1853.     (goal upgrade-conflict 37)
  1854.     (can-research-with-escrow ri-keep)
  1855. =>
  1856.     (release-escrow food)
  1857.     (release-escrow stone)
  1858.     (research ri-keep)
  1859.     (set-goal upgrade-conflict NO)
  1860. )
  1861.  
  1862. (defrule    ;800 food, 400 stone
  1863.     (goal upgrade-conflict NO)
  1864.     (random-number <= 38)
  1865.     (building-type-count university > 0)
  1866.     (building-type-count watch-tower-line > 2)
  1867.     (research-available ri-bombard-tower)
  1868. =>
  1869.     (set-goal upgrade-conflict 38)
  1870.     (set-goal resource-supp FOOD-STONE)
  1871. )
  1872.  
  1873. (defrule
  1874.     (goal upgrade-conflict 38)
  1875.     (can-research-with-escrow ri-bombard-tower)
  1876. =>
  1877.     (release-escrow food)
  1878.     (release-escrow stone)
  1879.     (research ri-bombard-tower)
  1880.     (set-goal upgrade-conflict NO)
  1881. )
  1882.  
  1883. (defrule    ;200 food, 200 stone
  1884.     (can-research-with-escrow ri-murder-holes)
  1885.     (or
  1886.         (building-type-count watch-tower-line > 1)
  1887.         (building-type-count castle > 0)
  1888.     )
  1889. =>
  1890.     (release-escrow food)
  1891.     (release-escrow stone)
  1892.     (research ri-murder-holes)
  1893. )
  1894.  
  1895. (defrule    ;200 food, 100 stone
  1896.     (goal wall-build YES)
  1897.     (can-research-with-escrow ri-fortified-wall)
  1898. =>
  1899.     (release-escrow food)
  1900.     (release-escrow stone)
  1901.     (research ri-fortified-wall)
  1902. )
  1903.  
  1904. (defrule    ;350 food, 100 gold
  1905.     (goal upgrade-conflict NO)
  1906.     (random-number <= 39)
  1907.     (building-type-count university > 0)
  1908.     (research-available ri-heated-shot)
  1909.     (nor
  1910.         (goal 1 0)
  1911.         (goal 2 2)
  1912.     )
  1913. =>
  1914.     (set-goal upgrade-conflict 39)
  1915.     (set-goal resource-supp FOOD-GOLD)
  1916. )
  1917.  
  1918. (defrule
  1919.     (goal upgrade-conflict 39)
  1920.     (can-research-with-escrow ri-heated-shot)
  1921. =>
  1922.     (release-escrow food)
  1923.     (release-escrow gold)
  1924.     (research ri-heated-shot)
  1925.     (set-goal upgrade-conflict NO)
  1926. )
  1927.  
  1928. (defrule    ;300 wood, 175 gold
  1929.     (goal upgrade-conflict NO)
  1930.     (random-number <= 40)
  1931.     (building-type-count university > 0)
  1932.     (research-available ri-ballistics)
  1933.     (or
  1934.         (unit-type-count galley-line >= five-percent-pop)
  1935.         (or
  1936.             (goal archer-upgrades YES)
  1937.             (research-completed ri-guard-tower)
  1938.         )
  1939.     )
  1940. =>
  1941.     (set-goal upgrade-conflict 40)
  1942.     (set-goal resource-supp WOOD-GOLD)
  1943. )
  1944.  
  1945. (defrule
  1946.     (goal upgrade-conflict 40)
  1947.     (can-research-with-escrow ri-ballistics)
  1948. =>
  1949.     (release-escrow wood)
  1950.     (release-escrow gold)
  1951.     (research ri-ballistics)
  1952.     (set-goal upgrade-conflict NO)
  1953. )
  1954.  
  1955. (defrule    ;300 food, 200 gold
  1956.     (building-type-count university > 0)
  1957.     (can-research-with-escrow ri-chemistry)
  1958. =>
  1959.     (release-escrow food)
  1960.     (release-escrow gold)
  1961.     (research ri-chemistry)
  1962. )
  1963. ;*************
  1964. ;CASTLE
  1965. (defrule    ;400 wood, 400 stone
  1966.     (goal upgrade-conflict NO)
  1967.     (random-number <= 41)
  1968.     (building-type-count castle > 0)
  1969.     (research-available ri-hoardings)
  1970.     (not (goal wonder-attempt POSSIBLE) )
  1971. =>
  1972.     (set-goal upgrade-conflict 41)
  1973.     (set-goal resource-supp WOOD-STONE)
  1974. )
  1975.  
  1976. (defrule
  1977.     (goal upgrade-conflict 41)
  1978.     (can-research-with-escrow ri-hoardings)
  1979. =>
  1980.     (release-escrow wood)
  1981.     (release-escrow stone)
  1982.     (research ri-hoardings)
  1983.     (set-goal upgrade-conflict NO)
  1984. )
  1985.  
  1986. (defrule    ;150 food, 150 gold
  1987.     (can-research-with-escrow ri-conscription)
  1988. =>
  1989.     (release-escrow food)
  1990.     (release-escrow gold)
  1991.     (research ri-conscription)
  1992. )
  1993.  
  1994.